﻿using AKBGame.Constant;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AKBGame.Service
{
    public class GroupEventPointCalculator
    {
        public class BasicScore
        {
            public const int Easy = 120;
            public const int Normal = 240;
            public const int Hard = 360;
            public const int HS = 720;
            public const int Expert = 1080;
        }

        public class RankBonus
        {
            public const double C = 0;
            public const double B = 0;
            public const double A = 0;
            public const double S = 1;
            public const double SS = 1.75;
        }

        public int CalculatePoint(string difficulty, string rank, int numberOf30Cloth, int numberOf15Cloth)
        {
            double basicScore = 0;

            if (difficulty == Difficulty.Easy)
                basicScore = BasicScore.Easy;
            else if (difficulty == Difficulty.Normal)
                basicScore = BasicScore.Normal;
            else if (difficulty == Difficulty.Hard)
                basicScore = BasicScore.Hard;
            else if (difficulty == Difficulty.HS)
                basicScore = BasicScore.HS;
            else if (difficulty == Difficulty.Expert)
                basicScore = BasicScore.Expert;

            double rankBonus = 1;

            if (rank == Rank.C)
                rankBonus = RankBonus.C;
            else if (rank == Rank.B)
                rankBonus = RankBonus.B;
            else if (rank == Rank.A)
                rankBonus = RankBonus.A;
            else if (rank == Rank.S)
                rankBonus = RankBonus.S;
            else if (rank == Rank.SS)
                rankBonus = RankBonus.SS;

            double clothBonus;

            if (numberOf30Cloth + numberOf15Cloth <= 5)
                clothBonus = 0.4 * (numberOf30Cloth + numberOf15Cloth);
            else
                clothBonus = 2.5;

            basicScore = basicScore + basicScore * rankBonus + basicScore * clothBonus;

            return (int)basicScore;
        }
    }
}
